package com.imcode;

import java.util.*;

public class CollectionsDemo {
    public static void main(String[] args) {
//        List<Integer> c = new ArrayList<>();
//        Collections.addAll(c, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);

        List<String> c = new ArrayList<>();
        //Collections.addAll(c, "Baidu","Tec","Aliba");
        //Collections.addAll(c, "CDBC", "ADC", "ABC", "aAA", "ABCD", "BACD");
        Collections.addAll(c, "中国", "上海", "广州", "深圳", "武汉", "郑州");
        System.out.println(c);

        Collections.shuffle(c);//打乱集合顺序
        System.out.println(c);
        Collections.sort(c);//按照默认规则对集合排序  数字从小到大  单词按字母顺序A-Za-Z

        System.out.println(c);

//        Iterator<Integer> it = c.iterator();
//        while (it.hasNext()){
//            System.out.println(it.next());
//        }
    }
}
